import { nextTick, onActivated, onMounted } from 'vue';
// Todo
export const onMountedOrActivated = (hook: AnyFunction<any>) => {
  let mounted: boolean;
  
  onMounted(() => {
    hook();
    nextTick(() => {
      mounted = true;
    });
  });
  
  onActivated(() => {
    if (mounted) {
      hook();
    }
  });
};

export { tryOnUnmounted, tryOnMounted } from '@vueuse/core';
